package com.lakeworks.web.controller.core;

import com.lakeworks.common.core.controller.BaseController;
import com.lakeworks.common.core.domain.AjaxResult;
import com.lakeworks.common.core.page.TableDataInfo;
import com.lakeworks.domain.OprPickup;
import com.lakeworks.service.IOprPickupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotBlank;
import java.util.List;

/**
 * 入厂单Controller
 *
 * @author lake
 * @date 2023-02-08
 */
@RestController
@RequestMapping("/pickup")
public class OprPickupController extends BaseController {

    @Autowired
    private IOprPickupService oprPickupService;

    /**
     * 查询入厂单列表
     */
    @GetMapping("/list")
    public TableDataInfo list(OprPickup oprPickup) {
        startPage();
        List<OprPickup> list = oprPickupService.selectOprPickupList(oprPickup);
        return getDataTable(list);
    }

//    /**
//     * 导出入厂单列表
//     */
//    @Log(title = "入厂单", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public AjaxResult export(OprPickup oprPickup)
//    {
//        List<OprPickup> list = oprPickupService.selectOprPickupList(oprPickup);
//        ExcelUtil<OprPickup> util = new ExcelUtil<OprPickup>(OprPickup.class);
//        return util.exportExcel(list, "入厂单数据");
//    }

    /**
     * 入场单签收
     */
    @PostMapping("{expressNo}/signfor")
    public AjaxResult signFor(@NotBlank(message = "参数错误") @PathVariable("expressNo") String expressNo) {
        return oprPickupService.signFor(expressNo, true);
    }
}
